<%@page import="fy.com.controller.graph.GraphController"%>
<%@page import="org.apache.commons.fileupload.RequestContext"%>
<%@ page language="java" contentType="text/html" import="java.util.*,fy.com.util.PageData"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
	
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>曲线页面</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

 <%@ include file="../top.jsp"%>
 <%@ include file="../nav.jsp"%>

<style type="text/css">
.graph{
        float:left;
        border:1px solid gray;
        width:1150px;
        height:500px;
        margin:0 1em auto;
}
.device{
       float:right;
       border:1px solid gray;
       width:10%;
       margin:0 0.5em auto;
}
.device table th{
     background-color:#A7C0E0;
}
.table_device tr td{
	text-align:center;
}

</style>
</head>

<body>
<div>
	<table style="width:100%; margin-left:2em;">
		<tr>
			<td style="vertical-align:top;">
			<a class="btn btn-small btn-success" onclick="">温度</a>
			<a class="btn btn-small btn-warning" onclick="">湿度</a> 
			<a class="btn btn-small btn-danger" onclick="">经度</a> 
			<a class="btn btn-small btn-success" onclick="">纬度</a>
			<a class="btn btn-small btn-warning" onclick="">高度</a> 
			<a class="btn btn-small btn-danger" onclick="">气压</a> 
			<a class="btn btn-small btn-success" onclick="">烟雾</a>
			<a class="btn btn-small btn-warning" onclick="">红外</a> 
			<a class="btn btn-small btn-danger" onclick="">紫外</a> 
			<a class="btn btn-small btn-success" onclick="">超声</a>
			<a class="btn btn-small btn-warning" onclick="">加速度</a> 
			<a class="btn btn-small btn-danger" onclick="">陀螺仪</a> 
			</td>
		</tr>
	</table>
</div>

<div class="graph">
	<% 
		List<PageData> list = (List<PageData>)request.getAttribute("pd") ;
		final int size =list.size();
		request.setAttribute("size", size);
		String strXML1 = "";
		strXML1 += "<graph caption='温度表' xAxisName='设备' yAxisName='温度' decimalPrecision='1' formatNumberScale='0' showValues='0' drawAnchors='0' yAxisMinValue='1' numDivLines='10' lineThickness='1'>";
		
		for(int i=0;i<list.size();i++){	
		strXML1 += "<set name='"+list.get(i).get("time").toString()+"' value='"+list.get(i).get("temperature").toString()+"' color='AFD8F8'/>";	
		}
		strXML1 += "</graph>";
		%>
	<jsp:include page="FusionChartsHTMLRenderer.jsp" flush="true">
		<jsp:param name="chartSWF" value="static/FusionCharts/Line.swf" />
		<jsp:param name="strURL" value="" />
		<jsp:param name="strXML" value="<%=strXML1%>" />
		<jsp:param name="chartId" value="myNext" />
		<jsp:param name="chartWidth" value="1150" />
		<jsp:param name="chartHeight" value="500" />
		<jsp:param name="debugMode" value="false" />
		<jsp:param name="thickness" value="1" />
	</jsp:include>
	</div>
	
<div class="device">
	<table  class="table_device" style="width:100%; border:1px solid gray;">
		<thead>
	    	<tr>
	            <th><input type="checkbox" id="zcheckbox" /></th>
	            <th>设备号</th>
	            <th>状态</th>
	         </tr>
        </thead>
        <tbody>
          <c:choose>
				<c:when test="${not empty sList}">
					<c:forEach items="${sList}" var="var" varStatus="vs" >
						<tr >
							<td><input type='checkbox' name='ids' value="${var.eid}" /></td>
							<td><a href="realstatus.do?eid=${var.eid} ">设备${var.eid}</a> </td>
							<td>${var.status}</td>
						</tr>	
					</c:forEach>
				</c:when>
			</c:choose>
		</tbody>
    </table>
</div>	
</body>
</html>
